home *** CD-ROM | disk | FTP | other *** search
/ PC Advisor 2010 April / PCA177.iso / ESSENTIALS / Firefox Setup.exe / nonlocalized / chrome / browser.jar / content / browser / aboutDialog.js < prev    next >
Encoding:
JavaScript  |  2009-07-15  |  2.6 KB  |  79 lines

  1. //@line 37 "e:\builds\moz2_slave\win32_build\build\browser\base\content\aboutDialog.js"
  2.  
  3. var gSelectedPage = 0;
  4.  
  5. function init(aEvent) 
  6. {
  7.   if (aEvent.target != document)
  8.     return;
  9.  
  10.   var prefs = Components.classes["@mozilla.org/preferences-service;1"]
  11.                         .getService(Components.interfaces.nsIPrefBranch);
  12.  
  13.   try {
  14.     var distroId = prefs.getCharPref("distribution.id");
  15.     if (distroId) {
  16.       var distroVersion = prefs.getCharPref("distribution.version");
  17.       var distroAbout = prefs.getComplexValue("distribution.about",
  18.         Components.interfaces.nsISupportsString);
  19.   
  20.       var distroField = document.getElementById("distribution");
  21.       distroField.value = distroAbout;
  22.       distroField.style.display = "block";
  23.     
  24.       var distroIdField = document.getElementById("distributionId");
  25.       distroIdField.value = distroId + " - " + distroVersion;
  26.       distroIdField.style.display = "block";
  27.     }
  28.   }
  29.   catch (e) {
  30.     // Pref is unset
  31.   }
  32.  
  33.   var userAgentField = document.getElementById("userAgent");
  34.   userAgentField.value = navigator.userAgent;
  35.  
  36.   var button = document.documentElement.getButton("extra2");
  37.   button.setAttribute("label", document.documentElement.getAttribute("creditslabel"));
  38.   button.setAttribute("accesskey", document.documentElement.getAttribute("creditsaccesskey"));
  39.   button.addEventListener("command", switchPage, false);
  40.  
  41.   var acceptButton = document.documentElement.getButton("accept");
  42. //@line 80 "e:\builds\moz2_slave\win32_build\build\browser\base\content\aboutDialog.js"
  43.   acceptButton.focus();
  44.  
  45. //@line 87 "e:\builds\moz2_slave\win32_build\build\browser\base\content\aboutDialog.js"
  46. }
  47.  
  48. function uninit(aEvent)
  49. {
  50.   if (aEvent.target != document)
  51.     return;
  52.   var iframe = document.getElementById("creditsIframe");
  53.   iframe.setAttribute("src", "");
  54. }
  55.  
  56. function switchPage(aEvent)
  57. {
  58.   var button = aEvent.target;
  59.   if (button.localName != "button")
  60.     return;
  61.  
  62.   var iframe = document.getElementById("creditsIframe");
  63.   if (gSelectedPage == 0) { 
  64.     iframe.setAttribute("src", "chrome://browser/content/credits.xhtml");
  65.     button.setAttribute("label", document.documentElement.getAttribute("aboutlabel"));
  66.     button.setAttribute("accesskey", document.documentElement.getAttribute("aboutaccesskey"));
  67.     gSelectedPage = 1;
  68.   }
  69.   else {
  70.     iframe.setAttribute("src", ""); 
  71.     button.setAttribute("label", document.documentElement.getAttribute("creditslabel"));
  72.     button.setAttribute("accesskey", document.documentElement.getAttribute("creditsaccesskey"));
  73.     gSelectedPage = 0;
  74.   }
  75.   var modes = document.getElementById("modes");
  76.   modes.setAttribute("selectedIndex", gSelectedPage);
  77. }
  78.  
  79.